package com.xxl.job.executor.persistence.beans;

import com.google.gson.annotations.SerializedName;

import java.math.BigDecimal;


/**
 * Created by yzm on 2019/06/14.
 */
public class SplitProvince implements BaseData {

    @SerializedName(value = "TOLLPROVINCEID", alternate = {"tollProvinceId","provinceId"})
    private String tollProvinceId;
    @SerializedName(value = "TOLLSUPPORT", alternate = {"tollSupport"})
    private String tollSupport;
    @SerializedName(value = "TOLLFEE", alternate = {"tollFee"})
    private BigDecimal tollFee;
    @SerializedName(value = "SECTIONGROUP", alternate = {"sectionGroup"})
    private String sectionGroup;
    @SerializedName(value = "SECTIONNAME", alternate = {"sectionName"})
    private String sectionName;
    @SerializedName(value = "TOLLINTERVALSCOUNT", alternate = {"tollIntervalsCount"})
    private BigDecimal tollIntervalsCount;
    @SerializedName(value = "TOLLINTERVALSGROUP", alternate = {"tollIntervalsGroup"})
    private String tollIntervalsGroup;
    @SerializedName(value = "TRANSTIMEGROUP", alternate = {"transTimeGroup"})
    private String transTimeGroup;
    @SerializedName(value = "CHARGEPAYGROUP", alternate = {"chargePayGroup"})
    private String chargePayGroup;
    @SerializedName(value = "CHARGEFEEGROUP", alternate = {"chargefeeGroup"})
    private String chargefeeGroup;
    @SerializedName(value = "CHARGEDISCOUNTGROUP", alternate = {"chargeDiscountGroup"})
    private String chargeDiscountGroup;
    @SerializedName(value = "RATEVERSIONGROUP", alternate = {"rateVersionGroup"})
    private String rateVersionGroup;
    private String listNo;

    public String getTollProvinceId() {
        return tollProvinceId;
    }

    public void setTollProvinceId(String tollProvinceId) {
        this.tollProvinceId = tollProvinceId;
    }

    public String getTollSupport() {
        return tollSupport;
    }

    public void setTollSupport(String tollSupport) {
        this.tollSupport = tollSupport;
    }

    public BigDecimal getTollFee() {
        return tollFee;
    }

    public void setTollFee(BigDecimal tollFee) {
        this.tollFee = tollFee;
    }

    public String getSectionGroup() {
        return sectionGroup;
    }

    public void setSectionGroup(String sectionGroup) {
        this.sectionGroup = sectionGroup;
    }

    public String getSectionName() {
        return sectionName;
    }

    public void setSectionName(String sectionName) {
        this.sectionName = sectionName;
    }

    public BigDecimal getTollIntervalsCount() {
        return tollIntervalsCount;
    }

    public void setTollIntervalsCount(BigDecimal tollIntervalsCount) {
        this.tollIntervalsCount = tollIntervalsCount;
    }

    public String getTollIntervalsGroup() {
        return tollIntervalsGroup;
    }

    public void setTollIntervalsGroup(String tollIntervalsGroup) {
        this.tollIntervalsGroup = tollIntervalsGroup;
    }

    public String getTransTimeGroup() {
        return transTimeGroup;
    }

    public void setTransTimeGroup(String transTimeGroup) {
        this.transTimeGroup = transTimeGroup;
    }

    public String getChargePayGroup() {
        return chargePayGroup;
    }

    public void setChargePayGroup(String chargePayGroup) {
        this.chargePayGroup = chargePayGroup;
    }

    public String getChargefeeGroup() {
        return chargefeeGroup;
    }

    public void setChargefeeGroup(String chargefeeGroup) {
        this.chargefeeGroup = chargefeeGroup;
    }

    public String getChargeDiscountGroup() {
        return chargeDiscountGroup;
    }

    public void setChargeDiscountGroup(String chargeDiscountGroup) {
        this.chargeDiscountGroup = chargeDiscountGroup;
    }

    public String getRateVersionGroup() {
        return rateVersionGroup;
    }

    public void setRateVersionGroup(String rateVersionGroup) {
        this.rateVersionGroup = rateVersionGroup;
    }

    public String getListNo() {
        return listNo;
    }

    public void setListNo(String listNo) {
        this.listNo = listNo;
    }

    @Override
    public String findStringByKey(String key) throws Exception {
        String ret = "#{$NOT_FOUND$}#";
        switch (key) {
            case "TOLLPROVINCEID": ret = getTollProvinceId();break;
            case "SECTIONGROUP": ret = getSectionGroup();break;
            case "SECTIONNAME": ret = getSectionName();break;
            case "TOLLINTERVALSGROUP": ret = getTollIntervalsGroup();break;
            case "TRANSTIMEGROUP": ret = getTransTimeGroup();break;
            case "CHARGEPAYGROUP": ret = getChargePayGroup();break;
            case "CHARGEFEEGROUP": ret = getChargefeeGroup();break;
            case "CHARGEDISCOUNTGROUP": ret = getChargeDiscountGroup();break;
            case "RATEVERSIONGROUP": ret = getRateVersionGroup();break;
            case "LISTNO": ret = getListNo();break;
            default:break;
        }
        if (ret != null && ret.equals("#{$NOT_FOUND$}#")) {
            throw new Exception("SplitProvince未匹配到数据:"+key);
        }
        return ret;
    }

    @Override
    public BigDecimal findNumberByKey(String key) throws Exception {
        BigDecimal ret = null;
        boolean bNeeded = false;
        switch (key) {
            case "TOLLFEE": ret = getTollFee();bNeeded = true;break;
            case "TOLLSUPPORT": ret = new BigDecimal(getTollSupport());bNeeded = true;break;//Json串中是字符串，清分是NUMBER，所以要String转BigDecimal

            case "TOLLINTERVALSCOUNT": ret = getTollIntervalsCount();break;
            default:bNeeded = true;break;
        }
        if (ret == null && bNeeded) {
            throw new Exception("SplitProvince未匹配到数据:"+key);
        }
        return ret;
    }
}
